package ExceptionDemo1;

public class ExceptionDemo3 {
    public static void main(String[] args) {
        System.out.println("程序开始执行");
        divide(103);
        System.out.println("程序执行结束");
    }
    public static void divide(int age)  {   // 抛出运行时异常,不需要写Throw ThrowException3，会默认写
            if(age<1||age>100){
                throw new ThrowException3("年龄不在范围");
            }
            else{
                System.out.println("年龄在范围");
            }

        }
    }